<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Map类型转换</title>
</head>
<body>
    <script>
        let map = new Map([["china","css"],["english","js"]]);

        console.log([...map]);  //相当于console.log([...map.entries()]);
        console.log([...map.keys()]);
        console.log([...map.values()]);

        // for...of...用的就是entries()方法
        for (const [key,value] of map) {
            console.log(key,value);
        };


        // 查找map中值为css的元素
        let newArr = [...map].filter(function (value) {
            return value[1].includes("css");
        });
        let hd = new Map(newArr);
        console.log(hd);
        console.log(...hd.values());
    </script>
</body>
</html>